package ygg.encoding.swf.tag.codec
{
	import j.sus2maj7.encoding.*;
	import j.sus2maj7.context.*;
	
	
	import ygg.encoding.swf.tag.*;
	import ygg.encoding.swf.tag.object.*;
	
	public class SymbolClassCodec extends TagCodec
	{
		public function SymbolClassCodec()
		{
			super();
		}
		
		override public function decode(binary:IBinary, context:IContext=null):*
		{
			var retVal:SymbolClass = new SymbolClass();
			var b:TagBinary = binary as TagBinary;
			b.position = 0;
			b.syncBits();
			
			
			var count:uint = b.readU16();
			trace('symbolscount=', count, count.toString(2) );
			
			retVal.symbols = new Array(count);
			var i:int;
			var j:uint;
			var k:String;
			
			trace(count);
			for (i = 0; i < count; i++)
			{
				j = b.readU16();
				k = b.readString();
				
				//trace(i, j, k);
				retVal.symbols[j] = k;
			}
			
			return retVal;
		}
		
		override public function encode(o:*, context:IContext=null):IBinary
		{
			var b:TagBinary = new TagBinary();
			var obj:SymbolClass = o as SymbolClass;
			
			
			
			return b;
		}
	}
}